import service from "../utils/request";

/**
 * 获取所有属性类型列表
 * @returns {Promise} 属性类型列表数据
 */
export function getTypesList() {
    return service.get("/types");
}

/**
 * 根据ID获取属性类型详情
 * @param {number} id 属性类型ID
 * @returns {Promise} 属性类型详情
 */
export function getTypeById(id) {
    return service.get(`/types/${id}`);
}

/**
 * 获取模拟属性类型数据（用于后端API不可用时的备用方案）
 * @returns {Promise} 模拟属性类型列表数据
 */
export function getMockTypesList() {
    return Promise.resolve({
        flag: true,
        data: [
            { id: 1, typeName: "一般", color: "#A8A878" },
            { id: 2, typeName: "火", color: "#F08030" },
            { id: 3, typeName: "水", color: "#6890F0" },
            { id: 4, typeName: "草", color: "#78C850" },
            { id: 5, typeName: "电", color: "#F8D030" },
            { id: 6, typeName: "冰", color: "#98D8D8" },
            { id: 7, typeName: "格斗", color: "#C03028" },
            { id: 8, typeName: "毒", color: "#A040A0" },
            { id: 9, typeName: "地面", color: "#E0C068" },
            { id: 10, typeName: "飞行", color: "#A890F0" },
            { id: 11, typeName: "超能力", color: "#F85888" },
            { id: 12, typeName: "虫", color: "#A8B820" },
            { id: 13, typeName: "岩石", color: "#B8A038" },
            { id: 14, typeName: "幽灵", color: "#705898" },
            { id: 15, typeName: "龙", color: "#7038F8" },
            { id: 16, typeName: "恶", color: "#705848" },
            { id: 17, typeName: "钢", color: "#B7B7CE" },
            { id: 18, typeName: "妖精", color: "#EE99AC" }
        ],
        msg: "模拟属性类型数据加载成功"
    });
} 